﻿namespace Community.CsharpSqlite.Entity
{
    /*
    ** Structure containing global configuration data for the SQLite library.
    **
    ** This structure also contains some state information.
    */

    public class Sqlite3Config
    {
        public bool bCoreMutex; /* True to enable core mutexing */
        public bool bFullMutex; /* True to enable full mutexing */
        public bool bMemstat; /* True to enable memory status */
        public int inProgress; /* True while initialization in progress */
        public int isInit; /* True after initialization has finished */
        public int isMallocInit; /* True after malloc is initialized */
        public int isMutexInit; /* True after mutexes are initialized */
        public int isPCacheInit; /* True after malloc is initialized */
        public sqlite3_mem_methods m; /* Low-level memory allocation interface */
        public int mnReq; /* Min and max heap requests sizes */
        public sqlite3_mutex_methods mutex; /* Low-level mutex interface */
        public int mxParserStack; /* maximum depth of the parser stack */
        public int mxReq; /* Min and max heap requests sizes */
        public int mxStrlen; /* Maximum string length */
        public int nHeap; /* Size of pHeap[] */
        public int nLookaside; /* Default lookaside buffer count */
        public int nPage; /* Number of pages in pPage[] */
        public int nRefInitMutex; /* Number of users of pInitMutex */
        public int nScratch; /* Number of scratch buffers */
        public byte[] pHeap; /* Heap storage space */
        public sqlite3_mutex pInitMutex; /* Mutex used by sqlite3_initialize() */
        public object pLogArg; /* First argument to xLog() */
        public MemPage pPage; /* Page cache memory */
        public byte[][] pScratch; /* Scratch memory */
        public byte[][] pScratch2; /* Scratch memory */
        public sqlite3_pcache_methods pcache; /* Low-level page-cache interface */
        public bool sharedCacheEnabled; /* true if shared-cache mode enabled */
        public int szLookaside; /* Default lookaside buffer size */
        public int szPage; /* Size of each page in pPage[] */
        public int szScratch; /* Size of each scratch buffer */
        /* The above might be initialized to non-zero.  The following need to always
        ** initially be zero, however. */
        public dxLog xLog; //void (*xLog)(void*,int,const char*); /* Function for logging */

        public Sqlite3Config(int bMemstat, int bCoreMutex, bool bFullMutex, int mxStrlen, int szLookaside,
                             int nLookaside
                             , sqlite3_mem_methods m
                             , sqlite3_mutex_methods mutex
                             , sqlite3_pcache_methods pcache
                             , byte[] pHeap
                             , int nHeap,
                             int mnReq, int mxReq
                             , byte[][] pScratch
                             , int szScratch
                             , int nScratch
                             , MemPage pPage
                             , int szPage
                             , int nPage
                             , int mxParserStack
                             , bool sharedCacheEnabled
                             , int isInit
                             , int inProgress
                             , int isMutexInit
                             , int isMallocInit
                             , int isPCacheInit
                             , sqlite3_mutex pInitMutex
                             , int nRefInitMutex
                             , dxLog xLog
                             , object pLogArg
            )
        {
            this.bMemstat = bMemstat != 0;
            this.bCoreMutex = bCoreMutex != 0;
            this.bFullMutex = bFullMutex;
            this.mxStrlen = mxStrlen;
            this.szLookaside = szLookaside;
            this.nLookaside = nLookaside;
            this.m = m;
            this.mutex = mutex;
            this.pcache = pcache;
            this.pHeap = pHeap;
            this.nHeap = nHeap;
            this.mnReq = mnReq;
            this.mxReq = mxReq;
            this.pScratch = pScratch;
            this.szScratch = szScratch;
            this.nScratch = nScratch;
            this.pPage = pPage;
            this.szPage = szPage;
            this.nPage = nPage;
            this.mxParserStack = mxParserStack;
            this.sharedCacheEnabled = sharedCacheEnabled;
            this.isInit = isInit;
            this.inProgress = inProgress;
            this.isMutexInit = isMutexInit;
            this.isMallocInit = isMallocInit;
            this.isPCacheInit = isPCacheInit;
            this.pInitMutex = pInitMutex;
            this.nRefInitMutex = nRefInitMutex;
            this.xLog = xLog;
            this.pLogArg = pLogArg;
        }
    };
}